package com.crm.service.impl.trainingManager;

import com.crm.dao.mapper.customMapper.trainingCustomManager.TrainingContractCustomMapper;
import com.crm.dao.mapper.trainingManager.TrainingContractMapper;
import com.crm.model.entity.trainingManager.TrainingContract;
import com.crm.model.qo.trainingManager.TrainingContactListQO;
import com.crm.model.vo.trainingManager.TrainingContractDetailVO;
import com.crm.model.vo.trainingManager.TrainingContractVO;
import com.crm.service.trainingManager.TrainingContractDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (用户模块)内训管理
 * @author luojie
 * @date 2021/9/13 16:11
 */
@Service
public class TrainingContractDbServiceImpl implements TrainingContractDbService {

    @Autowired
    private TrainingContractMapper trainingContractMapper;

    @Autowired
    private TrainingContractCustomMapper trainingContractCustomMapper;

    @Override
    public Boolean insertTrainingContract(TrainingContract trainingContract) {
        int num = trainingContractMapper.insertSelective(trainingContract);
        return num > 0;
    }

    /**
     * (用户模块)内训管理--内训合同列表
     * @param trainingContactListQO --查询条件
     * @param orderStr              --排序
     * @author yincuimei
     * @return
     */
    @Override
    public List<TrainingContractVO> selectTrainingContractVOList(TrainingContactListQO trainingContactListQO, String orderStr) {
        return trainingContractCustomMapper.selectTrainingContractVOList(trainingContactListQO,orderStr);
    }

    /**
     * (用户模块)内训管理-》内训合同列表-》合同详情-》合同信息
     * @param trainingContractId --内训合同ID
     * @author yincuimei
     * @return
     */
    @Override
    public TrainingContractDetailVO selectTrainingContractDetailVO(String trainingContractId) {
        return trainingContractCustomMapper.selectTrainingContractDetailVO(trainingContractId);
    }

    /**
     * 内训线索池列表(管理)/内训线索(用户)内训详情--合同订单列表
     * @param trainingId  --内训ID
     * @return
     */
    @Override
    public List<TrainingContractVO> selectTrainingContractListByTrainingId(String trainingId,String orderStr) {
        return trainingContractCustomMapper.selectTrainingContractListByTrainingId(trainingId,orderStr);
    }
}
